<template>
  <div class="box">
    <TSComponentsEmit ref="tsComponent" @msg="printChildEvt"></TSComponentsEmit>
  </div>

</template>

<script setup lang="ts">
import { ref } from 'vue';
import TSComponentsEmit from './components/TSComponentsEmitS2F.vue';

// typeof TSComponentsChild: 得到组件类型
// InstanceType: 得到实例类型
const tsComponent = ref<InstanceType<typeof TSComponentsEmit> | null>(null)

const printChildEvt = (val: string | number) => {
  console.log('child evt msg:', val)
}

</script>

<style scoped>
.box {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 20px;
}
</style>
